#include <iostream>
#include <string>
#include <vector>
#include "split_string.h"
using std::cout;
using std::endl;
using std::string;
using std::vector;

vector<string> split( string& line, char x)
{
	vector <string> resVec;
	char * l=&line[0];
	char b[line.length()];
	char * r=b;
	
	if(line.length()==0)
		return resVec;
		
	int i,j,t=0;
	for(i=0;i<=line.size();i++){
		if(*(l+i)==x||*(l+i)=='\0'){
			for(j=0;j<i-t;j++){
				*(r+j)=*(l+t+j);
			}
			*(r+j)='\0';
			if(b[0]!='\0')
				resVec.push_back(b);
			t=i+1;
		}
	}

	return resVec ;
}

